package zhangyi.tdd.tribe.enrolling.domain;

import java.time.LocalDateTime;

public class EnrollingChannel {
    private final LocalDateTime deadline;
    private final int maximum;
    private int actualAmount = 0;

    private EnrollingChannel(LocalDateTime deadline, int maximum) {
        this.deadline = deadline;
        this.maximum = maximum;
    }

    public static EnrollingChannel of(LocalDateTime deadline, int maximum) {
        return new EnrollingChannel(deadline, maximum);
    }

    public boolean isClosed() {
        LocalDateTime now = LocalDateTime.now();
        if (actualAmount <= maximum && now.isBefore(deadline)) {
            return false;
        }
        return true;
    }
}
